﻿
namespace ReportsFactory
{
    public static class DB
    {
        public enum DBTypes
        {
            SQLSever,
            Oracle
        }

        public static string GenerateCompleteConnectionString(DBTypes dbType, string serverName, string dbName, string userName, string password)
        {
            string conStr = "";
            switch (dbType)
            {
                case DBTypes.SQLSever:
                    if (userName.IsEmpty())
                        conStr = "Data Source=" + serverName + ";Initial Catalog=" + dbName + ";Integrated Security=true;";
                    else
                        conStr = "Data Source=" + serverName + ";Initial Catalog=" + dbName + ";Uid=" + userName + "; Pwd=" + password + ";";
                    break;
                case DBTypes.Oracle:
                    break;
                default:
                    break;
            }
            return conStr;
        }

        public static string GenerateDBID(string serverName, string dbName)
        {
            return dbName.ToLower() + " (" + serverName.ToUpper() + ")";
        }
    }
}